home *** CD-ROM | disk | FTP | other *** search
/ CD/PC Actual 76 / DVD Actual 1 Marzo 2003.iso / Trial / TurboCAD 7.1 Pro / Data.Cab / F25473_ScriptCable.bas < prev    next >
Encoding:
BASIC Source File  |  2000-11-10  |  931 b   |  41 lines

  1. 'Script to create RRect Turbo Shape and add it to a TurboCAD drawing
  2. Global Const gkGRAPHIC = &H0B
  3. sub Main()
  4.     Dim g As Long
  5.     Dim r As Long
  6.     Dim v As Long
  7.     
  8.     Dim e As String    
  9.  
  10.     'Create a graphic with kind = gkGraphic and Regen Method
  11.     'RRect.Rectangle.  TCWGraphicCreate will cause OnNewGraphic
  12.     'to be called
  13.     g = TCWGraphicCreate(gkGraphic, "Cable.Length")
  14.  
  15.     'if we got an error, display error message and stop
  16.     if (TCWLastErrorGet(e) <> 0) Then
  17.         msgbox e
  18.         stop
  19.     end if
  20.  
  21.     'Need up update properties to get RegenGraphic to be called
  22.     e = TCWGraphicPropertySet(g, "PenColor", &H00FF0000)    
  23.     
  24.     if (TCWLastErrorGet(e) <> 0) Then
  25.         msgbox e
  26.     end if
  27.  
  28.     'Add the graphic to the drawing    
  29.     TCWGraphicAppend 0, g
  30.  
  31.     if (TCWLastErrorGet(e) <> 0) Then
  32.         msgbox e
  33.     end if
  34.  
  35.     'Force the graphic to be drawn on the drawing
  36.     TCWGraphicDraw g, 0
  37.     if (TCWLastErrorGet(e) <> 0) Then
  38.         msgbox e
  39.     end if
  40. end Sub
  41.